import request from '@/utils/request'

/**
 * 获取部门列表

 */
export const getDepartment = () => {
  return request({
    url: '/company/department'
  })
}
/**
 * 新增子部门
 * @param {*} data.code 部门编码，同级部门不可重复
 * @param {*} data.introduce 介绍
 * @param {*} data.manager 负责人名称
 * @param {*} data.name 部门名称
 * @param {*} data.pid 父级部门ID
 * @returns {promise}
 */
export const addDepartment = (data) => {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}
// 获取部门详情，编辑
export const getDepartDetail = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}
//  * 编辑部门
export const updateDepartment = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'PUT',
    data
  })
}
//  删除部门
export const delDepartment = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'

  })
}
